﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AssessmentTool.Controls.HelperWindow;

namespace AssessmentTool
{
    public partial class Legend : UserControl
    {
        private bool open;
        public bool Opened
        {
            get { return open; }
            set
            {
                open = value;
                if (open)
                {

                    Open.Begin();
                }
                else
                {
                    Close.Begin();
                }
            }
        }
        public Legend()
        {
            // Required to initialize variables
            InitializeComponent();
            open = false;
        }
        public void setHelper(IHelper help)
        {

            HelperContainer.Child = (UserControl)help;
            double height = ((UserControl)HelperContainer.Child).Height;
            heightValueApertura.Value = height;
            heightValueChiusura.Value = height;
            if (Opened)
                ContentLegend.Height = height;
        }
        private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Opened = !Opened;
            VisualStateManager.GoToState(this, "Normal", true);
        }

        private void Border_MouseEnter(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(this, "MouseOver", true);
        }

        private void Border_MouseLeave(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(this, "Normal", true);
        }
    }
}